#include <algorithm>
#include <iostream>
using namespace std;

const int kMaxN = 1e5 + 10;
const int kMaxQ = 1e5 + 10;

struct Update {
  int l, r, v;
} update[kMaxN];

struct Query {
  int l, r;
} query[kMaxQ];

int num[(kMaxN + kMaxQ) * 2];
int a[(kMaxN + kMaxQ) * 2], diff[(kMaxN + kMaxQ) * 2];
long long sum[(kMaxN + kMaxQ) * 2];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, q;
  int tot = 1;

  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    cin >> update[i].l >> update[i].r >> update[i].v;
    num[tot++] = update[i].l;
    num[tot++] = update[i].r;
  }
  for (int i = 0; i < q; i++) {
    cin >> query[i].l >> query[i].r;
    num[tot++] = query[i].l - 1;
    num[tot++] = query[i].r - 1;
  }
  sort(num + 1, num + tot);
  tot = unique(num + 1, num + tot) - num;
  for (int i = 0; i < n; i++) {
    int l = lower_bound(num + 1, num + tot, update[i].l) - num;
    int r = lower_bound(num + 1, num + tot, update[i].r) - num;

    diff[l] += update[i].v;
    diff[r] -= update[i].v;
  }

  for (int i = 1; i < tot; i++) {
    a[i] = a[i - 1] + diff[i];
  }
  for (int i = 1; i < tot; i++) {
    sum[i] = sum[i - 1] + (long long)a[i - 1] * (num[i] - num[i - 1] - 1) + a[i];
  }

  for (int i = 0; i < q; i++) {
    int l = lower_bound(num + 1, num + tot, query[i].l - 1) - num;
    int r = lower_bound(num + 1, num + tot, query[i].r - 1) - num;

    cout << sum[r] - sum[l] << "\n";
  }
  return 0;
}